/* CUC Online Judge - A cross-platform judge online system
 * Base on [Verwandlung Online Judge](https://github.com/hzxie/voj)
 * Copyright (C) 2021 Jinhe Zhang <307100890@qq.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 *                             /\/`\/\
 *                            _\ | | /_
 *                          -           -
 *                        /               \
 *                       | |-------------| |
 *                       | |^=-_#   #_-=^| |
 *                       \/ \O__/,_ \O__/ \/
 *                        \  \\\     \\\  /
 *                         _\     o     /_
 *                        |/ `--=___=--` \|
 *                       /              六 \
 *                      |  ____       __七_ |
 *                       \____/_\   /_\____/
 */
package org.verwandlung.voj.web.model;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 用户的Model.
 * 对应数据库中的voj_classes数据表.
 * 
 * @author Haozhe Xie
 */
public class ClassC implements Serializable {
	/**
	 * 用户的默认构造函数. 
	 */
	public ClassC() { }
	
	/**
	 * ClassC的构造函数.
	 * @param classname - 班级名
	 * @param lessonname - 课程名
	 * @param studentcount - 课程名
	 * @param language - 编程语言
	 */
	public ClassC(String classname, String lessonname, String lessonId, String lessonNum, String teacher, int studentcount, Language language, String term, User teaUser) {
		this.classname = classname;
		this.lessonname = lessonname;
		this.lessonId = lessonId;
		this.lessonNum = lessonNum;
		this.teacher = teacher;
		this.studentcount = studentcount;
		this.language = language;
		this.term = term;
		this.teaUser = teaUser;
	}
	
	/**
	 * ClassC类的构造函数.
	 * @param cid - 班级唯一标识符
	 * @param classname - 班级名
	 * @param lessonname - 课程名
	 * @param studentcount - 课程名
	 * @param language - 编程语言
	 */
	public ClassC(Long cid, String classname, String lessonname, String lessonId, String lessonNum, String teacher, int studentcount, Language language, String term, User teaUser) {
		this(classname, lessonname, lessonId, lessonNum, teacher, studentcount, language, term, teaUser);
		this.cid = cid;
	}

	/**
	 * 获取用户名.
	 * @return 用户名
	 */
	public String getClassname() {
		return classname;
	}
	public String getLessonname() {
		return lessonname;
	}
	public String getLessonId() {
		return lessonId;
	}
	public String getLessonNum() {
		return lessonNum;
	}
	public String getTeacher() {
		return teacher;
	}
	public int getStudentcount() {
		return studentcount;
	}
	public Language getLanguage() {
		return language;
	}
	public String getTerm() {
		return term;
	}
	public User getTeaUser() {
		return teaUser;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return (int) cid;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
		if ( obj instanceof ClassC ) {
			ClassC anotherUser = (ClassC)obj;
			return anotherUser.getcid() == cid;
		}
		return false;
	}

	public long getcid() {
		return this.cid;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return String.format("Class: [cid=%s, classname=%s, lessonname=%s, studentcount=%d, language=%s]", new Object[] { cid, classname, lessonname, studentcount, language});
	}
	
	private long cid;
	private String classname;
	private String lessonname;
	private String lessonId;
	private String lessonNum;
	private String teacher;
	private int studentcount;
	private User teaUser;
	@JsonIgnore
	private Language language;
	private String term;

	/**
	 * 唯一的序列化标识符.
	 */
	private static final long serialVersionUID = 2264535351943252508L;
}
